package com.qf.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.dto.DtsSerachDto;
import com.qf.mapper.DtsAccountTraceMapper;
import com.qf.pojo.DtsAccountTrace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * projectName: shop-manage
 *
 * @author: 元
 * time: 2021/9/15 0015 17:24
 * description:账户流水表实现类
 */
@Service
public class DtsAccountTraceServiceImpl implements DtsAccountTraceService{

    @Autowired
    private DtsAccountTraceMapper accountTraceMapper;


    @Override
    public Map findBrokerageBy(DtsSerachDto serachDto) {
        //使用分页
        PageHelper.startPage(serachDto.getPage(),serachDto.getLimit());
        //查询到数据
        List<DtsAccountTrace> accountTraceList = accountTraceMapper.findAccountTrace(serachDto);
        //分页封装数据
        PageInfo<DtsAccountTrace> pageInfo = new PageInfo<>(accountTraceList);
        //封装返回结果集
        Map data = new HashMap();
        data.put("total",pageInfo.getTotal());
        data.put("traceList",pageInfo.getList());

        return data;
    }
}
